package pl.edu.agh.pros.proxy.view.xmpp;

import java.util.Collection;

import pl.edu.agh.pros.proxy.model.XmppServerConfiguration;

import com.vaadin.data.util.BeanItemContainer;
import com.vaadin.ui.Table;

public class XmppServersTable extends Table {

	private static final long serialVersionUID = 1932167402124840400L;
	private BeanItemContainer<XmppServerConfiguration> beans = new BeanItemContainer<XmppServerConfiguration>(
			XmppServerConfiguration.class);

	public XmppServersTable(Collection<XmppServerConfiguration> xmppServerConfigurations) {

		if (xmppServerConfigurations != null) {
			beans.addAll(xmppServerConfigurations);
		}
		this.setContainerDataSource(beans);
		this.setWidth("50em");
		this.setVisibleColumns(new Object[] { "hostname", "port", "conferenceService" });
		this.setColumnHeaders(new String[] { "Hostname", "Port", "Conference Service" });
		this.setWriteThrough(false);
		this.setSelectable(true);
		this.setImmediate(true);
	}

}
